/*
 * FNISVGEditor - JavaScript - based editor for SVG graphics 
 * Copyright (C) 2008 - 2009 Antti Leppä / Foyt
 * http://www.foyt.fi
 * 
 * License: 
 * 
 * Licensed under GNU Lesser General Public License Version 2.1 or later (the "LGPL") 
 * http://www.gnu.org/licenses/lgpl.html
 */
FNISVGEditorElementScaledUndoController = Class.create(FNISVGEditorUndoController, {
  initialize: function ($super) { 
    $super();
  },
  undo: function (editorInstance, event) {       
    if (event.newBBox == undefined)
      event.newBBox = fi.foyt.svg.svgdom.FNISVGDOMUtils.getScreenBBox(event.element);
          
    var controller = getSVGElementControllerVault().getElementControllerFor(event.element);
    controller.resizeTo(event.element, event.oldBBox.width, event.oldBBox.height);
    controller.moveTo(event.element, event.oldBBox.x, event.oldBBox.y);
    editorInstance.getSelectionManager().updateSelections();
  },
  redo: function (editorInstance, event) { 
    var controller = getSVGElementControllerVault().getElementControllerFor(event.element);
    controller.resizeTo(event.element, event.newBBox.width, event.newBBox.height);
    controller.moveTo(event.element, event.newBBox.x, event.newBBox.y);
    editorInstance.getSelectionManager().updateSelections();   
  },
  getEventType: function () {
    return "elementScaled";
  }
});

GetFNISVGEditorUndoEventControllerVault().registerController(new FNISVGEditorElementScaledUndoController());
